<demo>
## 柱状图
柱状图
</demo>

<!-- #region snippet -->
<template>
    <x-chart
        :height="height"
        :option="option"></x-chart>
</template>

<script setup>
import { ref } from 'vue'
import * as echarts from 'echarts'
const { xAxisTitle = [], series, height = 250 } = defineProps({ xAxisTitle: {}, series: {}, height: {} })
/** @type {echarts.EChartsOption} */
const option = {
    grid: {
        left: '70px',
        right: '32px',
        top: '8px',
        bottom: '24px',
    },
    tooltip: {
        trigger: 'axis',
    },
    xAxis: {
        type: 'category',
        data: xAxisTitle,
    },
    yAxis: {
        type: 'value',
    },
    series: series.map((i) => ({
        data: i.data,
        type: 'bar',
        name: i.name,
        barWidth: '15px',
    })),
}
</script>

<style lang="less" scoped></style>
<!-- #endregion snippet -->
